/**
 * Created by wang on 2016-8-31.
 */
define(['angular'], function (angular) {
    "use strict";

    var directive = function () {
        return {
            require: 'ngModel',
            link: function (scope, ele, attrs, ctl) {
                scope.$watch(attrs.ngModel, function () {
                    if (ctl.$modelValue > attrs.financingLoan || ctl.$modelValue < 1000) {
                        ctl.$setValidity('financingLoan', false);
                    }else{
                        ctl.$setValidity('financingLoan', true);
                    }
                });
            }
        }
    };

    directive.$inject = [];
    return directive;
});